package com.softeem.springboot02.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.softeem.springboot02.entity.User;
import com.softeem.springboot02.mapper.UserMapper;
import com.softeem.springboot02.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements IUserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public PageInfo<User> findByPage(Integer page, Integer limit) {
//        return  PageHelper.startPage(page, limit).doSelectPage(() -> userMapper.selectPage());
        PageHelper.startPage(page,limit);
        List<User> list = userMapper.selectPage();
        return  new PageInfo<User>(list);
    }
}
